#!/bin/bash -e
flake8 .

cd examples
GIT_ARG="--git-dir ../.git --work-tree .."

# find out modified python files, so that we ignored unstaged files
# exclude ../docs
MOD=$(git $GIT_ARG status -s \
	| grep -E '\.py$' | grep -v '../docs' \
	| grep -E '^ *M|^ *A' | cut -c 4- )
if [[ -n $MOD ]]; then
	flake8 $MOD
fi
